//
//  Configuration.swift
//  Yuyuto
//
//  Created by Arthur on 2017/6/16.
//  Copyright © 2017年 yuyuto. All rights reserved.
//  用于不同Configuration来配置

import Foundation
import UIKit
struct Configuration {
    lazy var enviroment: Environment = {
        if let configuration = Bundle.main.object(forInfoDictionaryKey: "Configuration") as? String {
            
            if configuration == "Debug" {
                return Environment.Debug;
            } else if configuration == "AdhcStaging" {
                return Environment.AdhcStaging;
            } else if configuration == "DebugProduction" {
                return Environment.DebugProduction;
            }  else if configuration == "AdhcProduction" {
                return Environment.AdhcProduction;
            }

        }
        
        return Environment.Release;
    }()
}

let onlineAppHost = "https://app.yuyuto.com/";
let testAppHost = "http://192.168.1.52/";

enum Environment: String {
    case AdhcStaging = "adhcStaging"
    case AdhcProduction = "adhcProduction"
    case Debug = "debug"
    case Release = "release"
    case DebugProduction = "debugProduction"
    
    // 设置服务器地址
    var host: String {
        
        switch self {
        case .Debug, .AdhcStaging:
            return testAppHost;
        case .Release, .AdhcProduction, .DebugProduction:
            return onlineAppHost;
        }
    }

}
